﻿using WeChat.CMS.Localization;
using Volo.Abp.AuditLogging;
using Volo.Abp.BackgroundJobs;
using Volo.Abp.FeatureManagement;
using Volo.Abp.Identity;
using Volo.Abp.Localization;
using Volo.Abp.Localization.ExceptionHandling;
using Volo.Abp.Modularity;
using Volo.Abp.OpenIddict;
using Volo.Abp.PermissionManagement;
using Volo.Abp.SettingManagement;
using Volo.Abp.TenantManagement;
using Volo.Abp.Validation.Localization;
using Volo.Abp.VirtualFileSystem;
using Volo.Abp.Identity.Localization;
using Volo.Abp.AuditLogging.Localization;
using EasyAbp.Abp.SettingUi.Localization;
using EasyAbp.Abp.SettingUi;
using SandAbp.Dictionary;
using SandAbp.ScheduleTask;
//using SandAbp.

namespace WeChat.CMS;
[DependsOn(
    typeof(AbpSettingUiDomainSharedModule),
    typeof(AbpAuditLoggingDomainSharedModule),
    typeof(AbpBackgroundJobsDomainSharedModule),
    typeof(AbpFeatureManagementDomainSharedModule),
    typeof(AbpIdentityDomainSharedModule),
    typeof(AbpOpenIddictDomainSharedModule),
    typeof(AbpPermissionManagementDomainSharedModule),
    typeof(AbpSettingManagementDomainSharedModule),
    typeof(AbpTenantManagementDomainSharedModule),
    typeof(DictionaryDomainSharedModule),
    typeof(ScheduleTaskDomainSharedModule)
    )]
public class CMSDomainSharedModule : AbpModule
{
    public override void PreConfigureServices(ServiceConfigurationContext context)
    {
        CMSGlobalFeatureConfigurator.Configure();
        CMSModuleExtensionConfigurator.Configure();
    }

    public override void ConfigureServices(ServiceConfigurationContext context)
    {
        Configure<AbpVirtualFileSystemOptions>(options =>
        {
            options.FileSets.AddEmbedded<CMSDomainSharedModule>();
        });

        Configure<AbpLocalizationOptions>(options =>
        {
            options.Resources
                .Add<CMSResource>("en")
                .AddBaseTypes(typeof(AbpValidationResource))
                .AddVirtualJson("/Localization/CMS");
          
            options.DefaultResourceType = typeof(CMSResource);


            options.Resources
             .Get<SettingUiResource>()
             .AddVirtualJson("/Localization/CMS");

            options.Resources
                 .Get<AuditLoggingResource>()
                 .AddVirtualJson("/Localization/Volo/AuditLogging/Localization");

            options.Resources
              .Get<IdentityResource>()
              .AddVirtualJson(   "/Localization/Volo/Identity/Localization");


        });

        Configure<AbpExceptionLocalizationOptions>(options =>
        {
            options.MapCodeNamespace("CMS", typeof(CMSResource));
        });
    }
}
